﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.UI.Bovespa.Ordens.Communication.Bovespa.Ordens.Motivo;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.Ordens.Communication.Translator.DataContractToModel
{
    public static class Motivo
    {
        public static Model.Motivo ToMotivo(MotivoResponse from)
        {
            Model.Motivo to = null;

            if (from != null)
            {
                to = new Sinacor.UI.Bovespa.Ordens.Model.Motivo();

                to.Codigo = from.Codigo;
                to.Descricao = from.Descricao;
            }

            return to;
        }

        public static ModelCollection<Model.Motivo> ToMotivo(List<MotivoResponse> from)
        {
            ModelCollection<Model.Motivo> to = null;

            if (from != null)
            {
                to = new ModelCollection<Sinacor.UI.Bovespa.Ordens.Model.Motivo>();
                foreach (MotivoResponse item in from)
                    to.Add(ToMotivo(item));
            }

            return to;
        }
    }
}
